import java.util.Map;
import java.util.TreeMap;

public class MyThread extends Thread {
    //private volatile Map<Integer, String> mapDta = new TreeMap<>();
    private Map<Integer, String> mapDta = new TreeMap<>();
 
    public Map<Integer, String> getMapData() {
        return mapDta;
    }
 
    public void setMapDta(Map<Integer, String> mapDta) {
        this.mapDta = mapDta;
    }
 
    public void setMapInnerDta(int k, String v) {
        this.mapDta.put(k, v);
    }
 
    @Override
    public void run() {
        int count = 0;
        while (true) {
            System.out.println(mapDta);
            mapDta.put(++count, "" + count);
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
